import { isArray } from 'radash'

/** 去除对象空值 */
export function removeEmptyProperties(obj: any) {
  for (const key in obj) {
    if (obj[key] === null || obj[key] === undefined || obj[key] === '') {
      delete obj[key]
    }

    if (isArray(obj[key]) && obj[key].length === 0) {
      delete obj[key]
    }
  }

  return obj
}
